$.ajaxPrefilter(function(options){
  options.url = "http://ajax.frontend.itheima.net" + options.url;
  // 在headers中，填写请求头
  if(options.url.includes("/my/")){
    options.headers = {
      Authorization: localStorage.getItem('token')
      }
      options.complete = function (xhr) {
        if(xhr.responseJSON && xhr.responseJSON.status === 1 && xhr.responseJSON.messsage === '身份认证失败！'){
          localStorage.removeItem("token")
          location.href = '/login.html'
        }
      }
  }
})